using System;
using UnityEngine;

namespace ES3Types
{
	[UnityEngine.Scripting.Preserve]
	[ES3PropertiesAttribute("OnlineTime", "CurLevelIndex", "BossLevelChallengeResult", "TreasureGainedLevel", "CurBuilderLevel", "TowerPositionLevel", "MoneyTypeDataDic", "TowerStarDic", "SignDate", "SignTask", "PlayerTaskData", "PlayerSkillData", "CarSkillData")]
	public class ES3UserType_PlayerDataTemplate : ES3ObjectType
	{
		public static ES3Type Instance = null;

		public ES3UserType_PlayerDataTemplate() : base(typeof(TowerDefence_Zombie.PlayerDataTemplate)){ Instance = this; priority = 1; }


		protected override void WriteObject(object obj, ES3Writer writer)
		{
			var instance = (TowerDefence_Zombie.PlayerDataTemplate)obj;
			
			writer.WriteProperty("OnlineTime", instance.OnlineTime, ES3Type_int.Instance);
			writer.WriteProperty("CurLevelIndex", instance.CurLevelIndex, ES3Type_int.Instance);
			writer.WriteProperty("BossLevelChallengeResult", instance.BossLevelChallengeResult, ES3Type_bool.Instance);
			writer.WriteProperty("TreasureGainedLevel", instance.TreasureGainedLevel, ES3Internal.ES3TypeMgr.GetOrCreateES3Type(typeof(System.Collections.Generic.List<System.Int32>)));
			writer.WriteProperty("CurBuilderLevel", instance.CurBuilderLevel, ES3Type_int.Instance);
			writer.WriteProperty("TowerPositionLevel", instance.TowerPositionLevel, ES3Type_int.Instance);
			writer.WriteProperty("MoneyTypeDataDic", instance.MoneyTypeDataDic, ES3Internal.ES3TypeMgr.GetOrCreateES3Type(typeof(System.Collections.Generic.Dictionary<System.Int32, System.Int64>)));
			writer.WriteProperty("TowerStarDic", instance.TowerStarDic, ES3Internal.ES3TypeMgr.GetOrCreateES3Type(typeof(System.Collections.Generic.Dictionary<System.Int32, System.Int32>)));
			writer.WriteProperty("SignDate", instance.SignDate, ES3Internal.ES3TypeMgr.GetOrCreateES3Type(typeof(System.Collections.Generic.List<System.String>)));
			writer.WriteProperty("SignTask", instance.SignTask, ES3Internal.ES3TypeMgr.GetOrCreateES3Type(typeof(System.Collections.Generic.List<System.String>)));
			writer.WriteProperty("PlayerTaskData", instance.PlayerTaskData, ES3Internal.ES3TypeMgr.GetOrCreateES3Type(typeof(TowerDefence_Zombie.PlayerDailyTaskData)));
			writer.WriteProperty("PlayerSkillData", instance.PlayerSkillData, ES3Internal.ES3TypeMgr.GetOrCreateES3Type(typeof(TowerDefence_Zombie.PlayerSkillData)));
			writer.WriteProperty("CarSkillData", instance.CarSkillData, ES3Internal.ES3TypeMgr.GetOrCreateES3Type(typeof(TowerDefence_Zombie.PlayerSkillData.CarSkillData)));
		}

		protected override void ReadObject<T>(ES3Reader reader, object obj)
		{
			var instance = (TowerDefence_Zombie.PlayerDataTemplate)obj;
			foreach(string propertyName in reader.Properties)
			{
				switch(propertyName)
				{
					
					case "OnlineTime":
						instance.OnlineTime = reader.Read<System.Int32>(ES3Type_int.Instance);
						break;
					case "CurLevelIndex":
						instance.CurLevelIndex = reader.Read<System.Int32>(ES3Type_int.Instance);
						break;
					case "BossLevelChallengeResult":
						instance.BossLevelChallengeResult = reader.Read<System.Boolean>(ES3Type_bool.Instance);
						break;
					case "TreasureGainedLevel":
						instance.TreasureGainedLevel = reader.Read<System.Collections.Generic.List<System.Int32>>();
						break;
					case "CurBuilderLevel":
						instance.CurBuilderLevel = reader.Read<System.Int32>(ES3Type_int.Instance);
						break;
					case "TowerPositionLevel":
						instance.TowerPositionLevel = reader.Read<System.Int32>(ES3Type_int.Instance);
						break;
					case "MoneyTypeDataDic":
						instance.MoneyTypeDataDic = reader.Read<System.Collections.Generic.Dictionary<System.Int32, System.Int64>>();
						break;
					case "TowerStarDic":
						instance.TowerStarDic = reader.Read<System.Collections.Generic.Dictionary<System.Int32, System.Int32>>();
						break;
					case "SignDate":
						instance.SignDate = reader.Read<System.Collections.Generic.List<System.String>>();
						break;
					case "SignTask":
						instance.SignTask = reader.Read<System.Collections.Generic.List<System.String>>();
						break;
					case "PlayerTaskData":
						instance.PlayerTaskData = reader.Read<TowerDefence_Zombie.PlayerDailyTaskData>();
						break;
					case "PlayerSkillData":
						instance.PlayerSkillData = reader.Read<TowerDefence_Zombie.PlayerSkillData>();
						break;
					case "CarSkillData":
						instance.CarSkillData = reader.Read<TowerDefence_Zombie.PlayerSkillData.CarSkillData>();
						break;
					default:
						reader.Skip();
						break;
				}
			}
		}

		protected override object ReadObject<T>(ES3Reader reader)
		{
			var instance = new TowerDefence_Zombie.PlayerDataTemplate();
			ReadObject<T>(reader, instance);
			return instance;
		}
	}


	public class ES3UserType_PlayerDataTemplateArray : ES3ArrayType
	{
		public static ES3Type Instance;

		public ES3UserType_PlayerDataTemplateArray() : base(typeof(TowerDefence_Zombie.PlayerDataTemplate[]), ES3UserType_PlayerDataTemplate.Instance)
		{
			Instance = this;
		}
	}
}